package com.aigou.admin.aigouspringboot.controller.user;

import com.aigou.admin.aigouspringboot.common.LogScope;
import com.aigou.admin.aigouspringboot.entity.Product;
import com.aigou.admin.aigouspringboot.result.Result;
import com.aigou.admin.aigouspringboot.service.OrderProductService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController("/userOrderProductController")
@RequestMapping("/user/orderproduct")
public class OrderProductController {
    @Resource
    private OrderProductService orderProductService;

//    @GetMapping("/product/{userId}")
//    @LogScope(title = "购物车管理模块", content = "根据useId查询商品信息")
//    public Result getProduct(@PathVariable String userId) {
//        List<Product> products = orderProductService.getProduct(userId);
//        return Result.success(products);
//    }

    @DeleteMapping("/{id}")
    @LogScope(title = "订单管理模块", content = "根据id删除订单信息")
    public Result delete(@PathVariable String id) {

        int i = orderProductService.deleteOrderById(id);
        return i > 0 ? Result.success() : Result.error();
    }
}
